import { ArgumentMetadata, HttpException, HttpStatus, Injectable, PipeTransform } from '@nestjs/common';
@Injectable()
export class ValidateMobilePipe implements PipeTransform<string, string> {
  transform(value: string, metadata: ArgumentMetadata): any {
    const mobile=typeof value === 'number'?String(value):value;
    if (mobile.length!== 11) {
      throw new HttpException('非法手机号', HttpStatus.BAD_REQUEST);
    }
    return mobile;
  }
}